package com.jemmyee.core.plugin.email;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
/**
 * @Description:邮件发送
 * @author:jemmyee@gmail.com
 * @date:2010-10-28
 * @version:v1.0
 */
public class SimpleMail {

	@Autowired
	private MailSender mailSender;
	@Autowired
	private SimpleMailMessage simpleMailMessage;
	
	public SimpleMail(MailSender mailSender, SimpleMailMessage simpleMailMessage) {
		super();
		this.mailSender = mailSender;
		this.simpleMailMessage = simpleMailMessage;
	}



	/**
	 * 发送一封邮件
	 * 
	 * @auther jemmyee
	 * @date 2010-8-24
	 * @param to
	 * @param content
	 */
	public void sendOneMail(String subject,String content,String to) {
		simpleMailMessage.setTo(to);
		simpleMailMessage.setText(content);
		simpleMailMessage.setSubject(subject);
		try {
			mailSender.send(simpleMailMessage);
		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}

}
